home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / atexit.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  1KB  |  58 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. __all__ = [
  5.     'register']
  6. import sys
  7. _exithandlers = []
  8.  
  9. def _run_exitfuncs():
  10.     exc_info = None
  11.     while _exithandlers:
  12.         (func, targs, kargs) = _exithandlers.pop()
  13.         
  14.         try:
  15.             func(*targs, **kargs)
  16.         continue
  17.         except SystemExit:
  18.             exc_info = sys.exc_info()
  19.             continue
  20.             import traceback as traceback
  21.             print >>sys.stderr, 'Error in atexit._run_exitfuncs:'
  22.             traceback.print_exc()
  23.             exc_info = sys.exc_info()
  24.             continue
  25.         
  26.  
  27.         None<EXCEPTION MATCH>SystemExit
  28.     if exc_info is not None:
  29.         raise exc_info[0], exc_info[1], exc_info[2]
  30.     
  31.  
  32.  
  33. def register(func, *targs, **kargs):
  34.     _exithandlers.append((func, targs, kargs))
  35.  
  36. if hasattr(sys, 'exitfunc'):
  37.     register(sys.exitfunc)
  38.  
  39. sys.exitfunc = _run_exitfuncs
  40. if __name__ == '__main__':
  41.     
  42.     def x1():
  43.         print 'running x1'
  44.  
  45.     
  46.     def x2(n):
  47.         print 'running x2(%r)' % (n,)
  48.  
  49.     
  50.     def x3(n, kwd = None):
  51.         print 'running x3(%r, kwd=%r)' % (n, kwd)
  52.  
  53.     register(x1)
  54.     register(x2, 12)
  55.     register(x3, 5, 'bar')
  56.     register(x3, 'no kwd args')
  57.  
  58.